#include "_ADT_Hilmans_Package.h"
#include <stdlib.h>
#include <math.h>
//-------------------------------------------------------------------
// _HilPack_General

int _HilPack_General_LongStr(char *InputS){
   int L=0;
   while ((InputS[L]!='\0')&&(L<255)){
       L++;
   }
   return L;
}

int _HilPack_General_ExistChar(char *InputS, char C){
    int L,Found=0;
    for (L=0;L<_HilPack_General_LongStr(InputS);L++){
        if (InputS[L]==C){
            Found=L+1;
            L=_HilPack_General_LongStr(InputS);           
        }
    }
    return Found;
}

int _HilPack_General_AddChr(char InputS[], char InputC){
   int L=_HilPack_General_LongStr(InputS);
   InputS[L]=InputC;
   InputS[L+1]='\0';
   return (L+1);
}

int _HilPack_General_AddChrF(char InputS[], char InputC){
   int L,Long=_HilPack_General_LongStr(InputS);
   for (L=Long;L>=1;L--)
      InputS[L]=InputS[L-1];
   InputS[0]=InputC;
   InputS[Long+1]='\0';
   return (Long+1);
}

int _HilPack_General_DelChr(char InputS[]){
   int Long=_HilPack_General_LongStr(InputS);
   if (Long<=0)
       return 0;
   else {
       InputS[Long-1]=InputS[Long];
       return 1;
   }
}

int _HilPack_General_DelChrF(char InputS[]){
   int L,Long=_HilPack_General_LongStr(InputS);
   if (Long<=0)
       return 0;
   else {
       for (L=1;L<=Long;L++){
           InputS[L-1]=InputS[L];
       } 
   }     
}

int _HilPack_General_AddStr(char S1[], char S2[]){
   int L=0;
   int buff=_HilPack_General_LongStr(S1);
   while (S2[L]!='\0'){
       S1[buff+L]=S2[L];  
       L++;
   }   
   S1[buff+L]=S2[L];
   return L;
}

int _HilPack_General_CopyStr(char Output[], char Input[]){
   int L=0;
   while (Input[L]!='\0'){
      Output[L]=Input[L];
      L++;   
   } 
   Output[L]='\0';
   return L;
}

int _HilPack_General_ParseStr(char *StrIdx, char *InputS){
   int L=0;
   int Kurung=0;
   char *Idx;
  // printf("test1\n");
   _HilPack_General_CopyStr(StrIdx,"");
   while (L<_HilPack_General_LongStr(InputS)){
       if (InputS[L]=='('){
           Kurung++;
           StrIdx[L]=(char)(Kurung);                        
       }
       else if (InputS[L]==')'){
           StrIdx[L]=(char)(Kurung);       
           Kurung--;                 
       }  
       else 
           StrIdx[L]=(char)255;
    L++;
   }
   StrIdx[L]='\0';
   return L;
}


int _HilPack_General_ParseTwo(char *One, char *Two, char *InputS){
    int L=0;
    int Kurung=0;
    if (_HilPack_General_ExistChar(InputS,',')) {
        while ((InputS[L]!=',')||(Kurung>0)&&(L<=_HilPack_General_LongStr(InputS))){
           if (InputS[L]=='('){
              Kurung++;                 
           }   
           else if (InputS[L]==')'){
              Kurung--;                 
           }   
           L++;   
        } 
        if (Kurung>0)
            return 0;
        else {
           _HilPack_General_GetStr(One,InputS,0,L-1);
           _HilPack_General_GetStr(Two,InputS,L+1,_HilPack_General_LongStr(InputS)-1);
           return _HilPack_General_ExistChar(InputS,',');
        }
    }
    else {
       return 0;   
    }
}

int _HilPack_General_ParseThree(char *One, char *Two, char* Three, char *InputS){
     char Temp[100];
     int Result;
     _HilPack_General_ParseTwo(One,Two,InputS);
     Result=_HilPack_General_ParseTwo(Temp,Three,Two);
     _HilPack_General_CopyStr(Two,Temp);
     return Result;
}

int _HilPack_General_ParseColon(char *One, char *Two, char *InputS){
    int L=0;
    int Kurung=0;
    if (_HilPack_General_ExistChar(InputS,':')){
        while ((InputS[L]!=':')||(Kurung>0)&&(L<=_HilPack_General_LongStr(InputS))){
           if (InputS[L]=='('){
              Kurung++;                 
           }   
           else if (InputS[L]==')'){
              Kurung--;                 
           }   
           L++;   
        } 
        if (Kurung>0)
            return 0;
        else {
           _HilPack_General_GetStr(One,InputS,0,L-1);
           _HilPack_General_GetStr(Two,InputS,L+1,_HilPack_General_LongStr(InputS)-1);
           return _HilPack_General_ExistChar(InputS,',');
        }
    }
    else
       return 0;
}

int _HilPack_General_IsCell ( char Input[])	{
		int found,angka=0;
		int L=0;
		while ( Input[L]==' '){
			L++;
		}
      	while ( (Input[L]>='A')&&( Input[L]<='Z') ){
			L++;
			found=1;
		}
		while ( (Input[L]>=(char)48) && (Input[L]!='\0')&& (Input[L]<=(char)57)){
			L++;
			angka=1;
		}
		if ( (Input[L] == '\0') && (found== 1)&&(angka==1))
			return 1;
		else
	        return 0;		
}

int _HilPack_General_IsNum(char InputC){
   return ((InputC>='0')&&(InputC<='9'))||(InputC=='.');
}


int _HilPack_General_ParseCell(int *OutKol, int *OutBar, char *InputS){
    int Kolom, Baris;
    int I=0,J,K;
    char S[100];
    _HilPack_General_CopyStr(S,"");
    *OutKol=0;
    *OutBar=0;
    if (_HilPack_General_IsCell(InputS)){
       while (_HilPack_General_IsChar(InputS[I])){
           *OutKol*=26;
           *OutKol+=((int)InputS[I]-64);  
           I++;
       }   
       while (_HilPack_General_IsNum(InputS[I])&&(I<_HilPack_General_LongStr(InputS))){
           *OutBar*=10;
           *OutBar+=((int)InputS[I]-48); 
           I++; 
       }
    }
}

int _HilPack_General_ParseArea(int *Kol1, int *Bar1, int *Kol2, int *Bar2, char *InputS){
   char One[100],Two[100];
   int Result;
   _HilPack_General_ParseColon(One,Two,InputS);
   _HilPack_General_ParseCell(Kol1, Bar1, One);
   Result=_HilPack_General_ParseCell(Kol2, Bar2, Two);
   return Result;
}

int _HilPack_General_AddStrF(char S1[], char S2[]){
   int L=0,Result;
   int buff=_HilPack_General_LongStr(S2);
   char S[50];
   _HilPack_General_CopyStr(S,S1);
   _HilPack_General_CopyStr(S1,S2);
   Result=_HilPack_General_AddStr(S1,S);
   
   return Result;
}

int _HilPack_General_IsArea(char *InputS){
    int L=0;
    int B=0;
    if (_HilPack_General_ExistChar(InputS,':')){
        while (L<_HilPack_General_LongStr(InputS)){
           if (InputS[L]==':'){
              B=1;
              L=_HilPack_General_LongStr(InputS);                 
           }   
           L++;
        }     
    }
    return B;
}

int _HilPack_General_GetStr(char *OutputS, char *InputS, int Start, int Stop){
   char S[50];
   _HilPack_General_CopyStr(S,"");
   int L;
   for (L=Start;L<=Stop;L++){
       _HilPack_General_AddChr(S,InputS[L]);
   }  
   _HilPack_General_CopyStr(OutputS,S);
}

int _HilPack_General_SameStr(char *S1, char *S2){
    int L,B=1;
    if (_HilPack_General_LongStr(S1)!=_HilPack_General_LongStr(S2))
       return 0;
    else{
        for (L=0;L<_HilPack_General_LongStr(S1);L++)
            if (S1[L]!=S2[L])
               B=0;
        return B; 
    }
}

int _HilPack_General_ExistSub(char *OutputS,char *InputS){
   int L;
   int Long=_HilPack_General_LongStr(OutputS)-_HilPack_General_LongStr(InputS);
   int B=0;
   char S[50];
   
   if (Long>=0){
       for (L=0;L<=Long;L++){
           _HilPack_General_GetStr(S,OutputS,L,L+_HilPack_General_LongStr(InputS)-1);
           if (_HilPack_General_SameStr(S,InputS)){
               B=1;
               L=Long+1;                                                       
           }
       }                                
   }    
   return B; 
}

int _HilPack_General_IsChar(char InputC){
    return ((InputC>='A')&&(InputC<='Z'));
}   
    
int _HilPack_General_IsCell_2(char *InputS){
    return (_HilPack_General_IsChar(InputS[0]));
}

int _HilPack_General_IsString (char *InputS){
    return (InputS[0]=='\'');
}

int _HilPack_General_DelStrNum(char *OutputS, int Num){
   if (Num<=_HilPack_General_LongStr(OutputS)){
       OutputS[_HilPack_General_LongStr(OutputS)-Num]='\0';                        
   }  
}

int _HilPack_General_DelStrNumF(char *OutputS, int Num){
   int L,Long=_HilPack_General_LongStr(OutputS);
   if ((Num>Long)&&(Num<=0))
       return 0;
   else {
       for (L=1;L<=Num;L++){
           _HilPack_General_DelChrF(OutputS);
       } 
   } 
}

//------------------------------------------------------------------------
// _HilPack_StackINT

int _HilPack_StackINT_CreateEmpty(_HilPack_StackINT *S, int Size){
    (*S).T=(_HilPack_StackINT_infotype*)malloc(Size*sizeof(_HilPack_StackINT_infotype)); 
    (*S).Size=Size;
    _HilPack_StackINT_Top(*S)=_HilPack_StackINT_Nil; 
}
int _HilPack_StackINT_Destruct(_HilPack_StackINT *S){
    free((*S).T); 
}
int _HilPack_StackINT_IsEmpty(_HilPack_StackINT S){
    return _HilPack_StackINT_Top(S)<=_HilPack_StackINT_Nil;    
}
int _HilPack_StackINT_IsFull(_HilPack_StackINT S){
    return _HilPack_StackINT_Top(S)==_HilPack_StackINT_Size(S);   
}
int _HilPack_StackINT_Push(_HilPack_StackINT *S, _HilPack_StackINT_infotype X){
    _HilPack_StackINT_Top(*S)++;
    _HilPack_StackINT_InfoTop(*S)=X; 
}
int _HilPack_StackINT_Pop(_HilPack_StackINT *S, _HilPack_StackINT_infotype *X){
    *X=_HilPack_StackINT_InfoTop(*S);
    _HilPack_StackINT_Top(*S)--; 
}

//------------------------------------------------------------------------
// _HilPack_StackSTR

int _HilPack_StackSTR_CreateEmpty(_HilPack_StackSTR *S, int Size){
    (*S).T=(_HilPack_StackSTR_infotype*)malloc(Size*sizeof(_HilPack_StackSTR_infotype)); 
    (*S).Size=Size;
    _HilPack_StackSTR_Top(*S)=_HilPack_StackSTR_Nil; 
}
int _HilPack_StackSTR_Destruct(_HilPack_StackSTR *S){
    free((*S).T); 
}
int _HilPack_StackSTR_IsEmpty(_HilPack_StackSTR S){
    return _HilPack_StackSTR_Top(S)<=_HilPack_StackSTR_Nil;    
}
int _HilPack_StackSTR_IsFull(_HilPack_StackSTR S){
    return _HilPack_StackSTR_Top(S)==_HilPack_StackSTR_Size(S);   
}

int _HilPack_StackSTR_CopyStr(char Output[], char Input[]){
   int L=0;
   while (Input[L]!='\0'){
      Output[L]=Input[L];
      L++;   
   } 
   Output[L]='\0';
}

int _HilPack_StackSTR_Push(_HilPack_StackSTR *S, _HilPack_StackSTR_infotype X){
    _HilPack_StackSTR_Top(*S)++;
    //InfoTopS(*S)=X; 
    _HilPack_StackSTR_CopyStr(_HilPack_StackSTR_InfoTop(*S),X);
}
int _HilPack_StackSTR_Pop(_HilPack_StackSTR *S, _HilPack_StackSTR_infotype *X){
    //*X=InfoTopS(*S);
    _HilPack_StackSTR_CopyStr(*X,_HilPack_StackSTR_InfoTop(*S));
    _HilPack_StackSTR_Top(*S)--;
}

//------------------------------------------------------------------------
// _HilPack_MesinKarakter

int _HilPack_MesinKarakter_START()
{
	_HilPack_MesinKarakter_f = fopen(_HilPack_MesinKarakter_FILENAME, "r");
	return _HilPack_MesinKarakter_ADV();
}

int _HilPack_MesinKarakter_ADV()
{
	return fscanf(_HilPack_MesinKarakter_f, "%c", &_HilPack_MesinKarakter_CC);
}

int _HilPack_MesinKarakter_END()
{
	fclose(_HilPack_MesinKarakter_f);
}

//------------------------------------------------------------------------
// _HilPack_MesinKata

int _HilPack_MesinKata_IGNOREBLANK()
{
	while(_HilPack_MesinKarakter_CC == _HilPack_MesinKarakter_BLANK) _HilPack_MesinKarakter_ADV();
}

int _HilPack_MesinKata_INITAKSES()
{
	_HilPack_MesinKarakter_START();
	_HilPack_MesinKata_IGNOREBLANK();
}

int _HilPack_MesinKata_ADVKATA()
{
	_HilPack_MesinKata_salinKata();
	_HilPack_MesinKata_IGNOREBLANK();
}

int _HilPack_MesinKata_salinKata()
{
	_HilPack_MesinKata_CKata.Length = 0;
	int idx = 1;
	while((_HilPack_MesinKarakter_CC!=_HilPack_MesinKata_MARK) && (_HilPack_MesinKarakter_CC!=_HilPack_MesinKata_BLANK)) {
		if(idx >= _HilPack_MesinKata_NMax) {} // do nothing
		else {
			_HilPack_MesinKata_CKata.TabKata[idx] = _HilPack_MesinKarakter_CC;
			idx++;
			_HilPack_MesinKata_CKata.Length++;
		}
		if(_HilPack_MesinKarakter_ADV()==EOF) return;
	}
}

int _HilPack_MesinKata_tulisKata()
{
	int i = 1;
	for(i; i <= _HilPack_MesinKata_CKata.Length; i++) printf("%c", _HilPack_MesinKata_CKata.TabKata[i]);
}

int _HilPack_MesinKata_isKataSama(_HilPack_MesinKata K1, _HilPack_MesinKata K2)
{
	if(K1.Length != K2.Length) return 0;
	int i = 1;
	for(i; i <= K1.Length; i++) {
		if(K1.TabKata[i] != K2.TabKata[i]) return 0;
	}
	return 1;
}

//-----------------------------------------------------------------------
// _HilPack_Excel

int _HilPack_Excel_CopyKata(_HilPack_MesinKata *Output, char Input[]){
   int L=0;
   _HilPack_General_CopyStr((*Output).TabKata,Input);
   while (Input[L]!='\0')
         L++;
   (*Output).Length=L; 
}

int _HilPack_Excel_CopyToKata(_HilPack_MesinKata *Output, _HilPack_MesinKata Input){
     _HilPack_Excel_CopyKata(Output, Input.TabKata);   
}

int _HilPack_Excel_writeCell(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], int InKol, int InBar, _HilPack_MesinKata value){
     (Matriks)[InKol][InBar].kolom=InKol;
     (Matriks)[InKol][InBar].baris=InBar;
     (Matriks)[InKol][InBar].value=value;
     if (value.TabKata[0]=='='){
        (Matriks)[InKol][InBar].type=3;
        (Matriks)[InKol][InBar].value.TabKata[0]=' ';
     }
     else if (value.TabKata[0]=='\''){
        (Matriks)[InKol][InBar].type=1;
        _HilPack_General_GetStr((Matriks)[InKol][InBar].value.TabKata,value.TabKata,1,_HilPack_General_LongStr(value.TabKata)) ;
     }
     else 
        (Matriks)[InKol][InBar].type=1;
     return 1;
}

int _HilPack_Excel_writeCellParsing(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char *InputS, _HilPack_MesinKata value){
    int Kol, Bar;
    _HilPack_General_ParseCell(&Kol, &Bar, InputS);
    _HilPack_Excel_writeCell(Matriks,Kol,Bar,value);
    return 1;
}

int _HilPack_Excel_writeStr(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], int InKol, int InBar, char *InputS){
    _HilPack_MesinKata K;
    _HilPack_Excel_CopyKata(&K, InputS);
    _HilPack_Excel_writeCell(Matriks,InKol,InBar,K);
    return 1;
}

int _HilPack_Excel_writeStrParsing(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char *Cell, char *InputS){
    int Kol, Bar;
    _HilPack_General_ParseCell(&Kol, &Bar, Cell);
    _HilPack_Excel_writeStr(Matriks,Kol,Bar,InputS); 
}

int _HilPack_Excel_writeStrArea(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], int Kol1, int Bar1, int Kol2, int Bar2, char *InputS){
    _HilPack_MesinKata K;
    int InKol, InBar;
    _HilPack_Excel_CopyKata(&K, InputS);
    for (InBar=Bar1;InBar<=Bar2;InBar++)
       for (InKol=Kol1;InKol<=Kol2;InKol++)
          _HilPack_Excel_writeCell(Matriks,InKol,InBar,K);
}

int _HilPack_Excel_writeStrAreaParsing(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char *Cell, char *InputS){
    int Kol1, Bar1, Kol2, Bar2;
    _HilPack_General_ParseArea(&Kol1, &Bar1, &Kol2, &Bar2, Cell);
    _HilPack_Excel_writeStrArea(Matriks,Kol1, Bar1, Kol2, Bar2, InputS);
}

int _HilPack_Excel_removeCell(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], int InKol, int InBar){
    Matriks[InKol][InBar].type=0;
}

int _HilPack_Excel_removeCellParsing(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char*InputS){
    int InKol, InBar;
    _HilPack_General_ParseCell(&InKol,&InBar,InputS); 
    Matriks[InKol][InBar].type=0;
}

int _HilPack_Excel_removeArea(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], int Kol1, int Bar1, int Kol2, int Bar2){
    int InKol,InBar;
    
    for (InBar=Bar1;InBar<=Bar2;InBar++)
      for (InKol=Kol1;InKol<=Kol2;InKol++)
         Matriks[InKol][InBar].type=0;
}

int _HilPack_Excel_removeAreaParsing(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char*InputS){
   int Kol1, Bar1, Kol2, Bar2;
   _HilPack_General_ParseArea(&Kol1, &Bar1, &Kol2, &Bar2,InputS);
   _HilPack_Excel_removeArea(Matriks,Kol1,Bar1,Kol2,Bar2); 
}
int _HilPack_Excel_AddChr2(_HilPack_MesinKata *S, char InputC){
   int L=0;
   while( (*S).TabKata[L]!='\0')
	{
		L++;
	}
	(*S).Length=L;
	(*S).TabKata[L]=InputC;
	(*S).TabKata[L+1]='\0';
	
}

int _HilPack_Excel_conversidesimal (char CC){
    if ((CC>=65)&&(CC<=80))
        return ((int)CC-64);
    else if ((CC>=97)&&(CC<=122))
        return ((int)CC-96);
    else
        return 0;
}

int _HilPack_Excel_PisahCell (int *B1,int *B2, int *K1, int *K2, char Input[]){
		int L=0;
		_HilPack_MesinKata SInt;
		_HilPack_Excel_CopyKata(&SInt,"");
		while ( Input[L] != '\0'){
				while ( Input[L]==' '){
						L++;
					}
				*B1= _HilPack_Excel_conversidesimal(Input[L]);
				L++;
				while ( (Input[L] != ' ') && Input[L]!=':'){
						_HilPack_Excel_AddChr2(&SInt,Input[L]);
						L++;
					}
				_HilPack_Excel_AddChr2 (&SInt,'\0');
				  *K1=atoi(SInt.TabKata);
				_HilPack_Excel_CopyKata (&SInt,"");
				while ( Input[L]==' '){
						L++;
					}
				if ( Input [L] == ':'){
						L++;
					}
				while ( Input[L]==' '){
						L++;
					}
				  *B2= _HilPack_Excel_conversidesimal(Input[L]);
				L++;
				while ( (Input[L] != ' ') && (Input[L]!='\0')){
						_HilPack_Excel_AddChr2(&SInt,Input[L]);
						L++;
					}
					_HilPack_Excel_AddChr2 (&SInt,'\0');
				  *K2=atoi(SInt.TabKata);
		}
}

int _HilPack_Excel_displayMatrixRange(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], int Kol1, int Bar1, int Kol2, int Bar2){
    int baris,kolom; 
    int LC;
    int K,L;
    char Temp1[100];
    printf("\t|");
    for (LC=(char)(64+Kol1);LC<=(char)(64+Kol2);LC++)
       printf("   %c\t|",LC);
    printf("\n");
    
    for (baris=Bar1;baris<=Bar2;baris++){
        for (K=1;K<=9;K++){
            printf("-");
        }
        for (K=Kol1;K<=Kol2;K++){
            for (L=1;L<=8;L++){
                 printf("-");
        }
        }
        printf("\n   %d\t|",baris);
        for (kolom=Kol1;kolom<=Kol2;kolom++){
           // displayCell(C[MaxKolom][MaxBaris],kolom,baris);
           if (Matriks[kolom][baris].type>0){
               if (Matriks[kolom][baris].type==3){
                   _HilPack_Excel_Eval(Matriks,Temp1,Matriks[kolom][baris].value.TabKata);
                   printf("%s\t|",Temp1);
               }
               else
                   printf("%s\t|",Matriks[kolom][baris].value.TabKata);
           }
            else
                printf("\t|");
        }
        printf("\n");
    }
    
}

int _HilPack_Excel_displayMatrixRangeParsing(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char *InputS){
    int Kol1,Bar1,Kol2,Bar2;
    _HilPack_General_ParseArea(&Kol1,&Bar1,&Kol2,&Bar2,InputS);
    _HilPack_Excel_displayMatrixRange(Matriks,Kol1,Bar1,Kol2,Bar2);
}

int _HilPack_Excel_displayMatrix(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], int InKol, int InBar){
    _HilPack_Excel_displayMatrixRange(Matriks,1,1,InKol,InBar);
}


int _HilPack_Excel_displayMatrixParsing(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char *InputS){
    int Kol,Bar;
    _HilPack_General_ParseCell(&Kol,&Bar,InputS);
    _HilPack_Excel_displayMatrix(Matriks,Kol,Bar);
}

int _HilPack_Excel_display(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1]){
    _HilPack_Excel_displayMatrix(Matriks,8,10);
}


int _HilPack_Excel_displayFormula(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], int Kol1, int Bar1, int Kol2, int Bar2){
    int baris,kolom; 
    int LC;
    int K,L;
    int Temp1[100];
    printf("\t|");
    for (LC=(char)(64+Kol1);LC<=(char)(64+Kol2);LC++)
       printf("   %c\t|",LC);
    printf("\n");
    
    for (baris=Bar1;baris<=Bar2;baris++){
        for (K=1;K<=9;K++){
            printf("-");
        }
        for (K=Kol1;K<=Kol2;K++){
            for (L=1;L<=8;L++){
                 printf("-");
            }
        }
        printf("\n   %d\t|",baris);
        for (kolom=Kol1;kolom<=Kol2;kolom++){
           // displayCell(C[MaxKolom][MaxBaris],kolom,baris);
           if (Matriks[kolom][baris].type>0){
               if (Matriks[kolom][baris].type==1)
                  printf("\'%s\t|",Matriks[kolom][baris].value.TabKata);
               if (Matriks[kolom][baris].type==3)
                  printf("=%s\t|",Matriks[kolom][baris].value.TabKata);
               else 
                  printf("%s\t|",Matriks[kolom][baris].value.TabKata);
           }
            else
                printf("\t|");
        }
        printf("\n");
    }
}


int _HilPack_Excel_displayFormulaParsing(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char *InputS){
    int Kol1,Bar1,Kol2,Bar2;
    _HilPack_General_ParseArea(&Kol1,&Bar1,&Kol2,&Bar2,InputS);
    _HilPack_Excel_displayFormula(Matriks,Kol1,Bar1,Kol2,Bar2);
}

int _HilPack_Excel_GetOp(char *OutputS,int L){
    char Kamus[30][10]={")","(","SQR","SQRT","^","*","/","MOD","DIV","-","+","AND","OR","NOT","IF","SUM","AVERAGE",">","<","]]","[[","!!","=","COUNT","STDEV","MAX","MIN","CONCAT",",",""};
    _HilPack_General_CopyStr(OutputS,Kamus[L]);
}

int _HilPack_Excel_GetUnikOp(char *OutputS,int L){
    char Kamus[20][10]={"SUM","AVERAGE","COUNT","STDEV","MAX","MIN","IF","SQR","SQRT","CONCAT","MOD","DIV","AND","OR","NOT",""}; 
    _HilPack_General_CopyStr(OutputS,Kamus[L]);
}

int _HilPack_Excel_TotalOp(){
    int L=0;
    char S[100];
    do{
    _HilPack_Excel_GetOp(S,L);
    L++;
    }
    while (!_HilPack_General_SameStr(S,""));
    return L-1;
}

int _HilPack_Excel_TotalUnikOp(){
    int L=0;
    char S[100];
    do{
    _HilPack_Excel_GetUnikOp(S,L);
    L++;
    }
    while (!_HilPack_General_SameStr(S,""));
    return L-1;
}

int _HilPack_Excel_Preced(char *InputS){
    int L;
    int P=999;
    char S[100];
    for (L=0;L<=_HilPack_Excel_TotalOp();L++){
        _HilPack_Excel_GetOp(S, L);
        if (_HilPack_General_SameStr(InputS, S)){
            P=L;
            L=_HilPack_Excel_TotalOp()+1;                 
        }
    }
    return P;
}

int _HilPack_Excel_IsOp(char *InputS){
   int L,B=0;
   return _HilPack_Excel_Preced(InputS)<999;
}

int _HilPack_Excel_IsNum(char InputC){
   return ((InputC>='0')&&(InputC<='9'))||(InputC=='.');
}

int _HilPack_Excel_IsNumber(char *InputS){
    int B=1;
    int L=0;
    if (_HilPack_General_LongStr(InputS)<=0)
       return 0;
    else
    while (L<_HilPack_General_LongStr(InputS)){
        if (!_HilPack_Excel_IsNum(InputS[L])){
            B=0;
            L=_HilPack_General_LongStr(InputS)+1;                                       
        }  
        L++;
    }
    return B;
}

int _HilPack_Excel_ExistOp(char *InputS){
   int L;
   int B=-1;
   char S[100];
   for (L=0;L<_HilPack_Excel_TotalOp();L++){
       _HilPack_Excel_GetOp(S,L);
       if (_HilPack_General_ExistSub(InputS,S)){
            B=L;
            L=_HilPack_Excel_TotalOp();          
       }
   }     
   return B;
}

int _HilPack_Excel_ExistUnikOp(char *InputS){
   int L;
   int B=-1;
   char S[100];
   for (L=0;L<_HilPack_Excel_TotalUnikOp();L++){
       _HilPack_Excel_GetUnikOp(S,L);
       if (_HilPack_General_ExistSub(InputS,S)){
            B=L;
            L=_HilPack_Excel_TotalUnikOp();          
       }
   }     
   return B;
}

int _HilPack_Excel_FilterForm(char *InputS){
    int L=0;
    while (L<(_HilPack_General_LongStr(InputS)-1)){
       if ((InputS[L]=='>')&&(InputS[L+1]=='=')){
            InputS[L]=']';
            InputS[L+1]=']';                                    
       }
       else
       if ((InputS[L]=='<')&&(InputS[L+1]=='=')){
            InputS[L]='[';
            InputS[L+1]='[';                                    
       }
       else
       if ((InputS[L]=='!')&&(InputS[L+1]=='=')){
            InputS[L]='!';
            InputS[L+1]='!';                                    
       }
       L++;
    } 
     
}

int _HilPack_Excel_Parse(_HilPack_StackSTR *Val, _HilPack_StackSTR *Op, char *InputS){
   int L=0;
   int Kurung=0;
   char S[20]="",T[20],U[20],V[20],W[20],Before='x';
   while (L<_HilPack_General_LongStr(InputS)){
      _HilPack_General_CopyStr(T,S);
      _HilPack_General_AddChr(T,InputS[L]);
      _HilPack_General_CopyStr(V,S);
      _HilPack_Excel_GetOp(W,_HilPack_Excel_ExistOp(V));
      _HilPack_General_AddChr(V,InputS[L]);
      _HilPack_Excel_GetOp(U,_HilPack_Excel_ExistOp(V));
      if (InputS[L]==' '){                             // Karakter kosong
          if ((Before!=' ')&&(Before!='x')){
             if ((_HilPack_Excel_IsOp(S))&&(!((_HilPack_General_SameStr(W,"SQR"))&&(InputS[L]=='T')))){
                 
                 _HilPack_StackSTR_Push(Op,S); 
                 _HilPack_General_CopyStr(S,"");      
             }
             else {
                _HilPack_StackSTR_Push(Val,S);
                _HilPack_General_CopyStr(S,""); 
             }
          }
      }
      else if (_HilPack_Excel_IsOp(T)&&(!((_HilPack_General_SameStr(U,"SQR"))&&(InputS[L+1]=='T')))){                                 // bukan karakter kosong
       /*   if (!SameStr(T,"SQR")){
             PushS(Op,T); 
             CopyStr(S,""); 
          }   
          else if (InputS[L+1]!='T'){
             PushS(Op,T); 
             CopyStr(S,"");   
          }
          else*/ if (_HilPack_Excel_IsOp(T)){
             _HilPack_StackSTR_Push(Op,T);
             _HilPack_General_CopyStr(S,"");      
          }
          else {
             _HilPack_General_CopyStr(T,"");
             _HilPack_General_AddChr(T,InputS[L]);
          
             if (_HilPack_Excel_IsOp(T)){
                 if (_HilPack_General_LongStr(S)>0){
                     if (_HilPack_Excel_IsNumber(S))
                     _HilPack_StackSTR_Push(Val,S);
                     _HilPack_General_CopyStr(S,"");
                 }
                 _HilPack_StackSTR_Push(Op,T); 
                 
                 _HilPack_General_CopyStr(T,"");          
             }
             else
                _HilPack_General_AddChr(S,InputS[L]);
          }
      }
      else {
          _HilPack_General_CopyStr(T,"");
          _HilPack_General_AddChr(T,InputS[L]);
          
          if (_HilPack_Excel_IsOp(T)){
              if (_HilPack_General_LongStr(S)>0){
                  _HilPack_StackSTR_Push(Val,S);
                  _HilPack_General_CopyStr(S,"");
              }
              _HilPack_StackSTR_Push(Op,T); 
              _HilPack_General_CopyStr(T,"");          
          }
          else if ((_HilPack_Excel_ExistOp(V)!=-1)&&(!((_HilPack_General_SameStr(U,"SQR"))&&(InputS[L+1]=='T')))){     
              _HilPack_Excel_GetOp(U,_HilPack_Excel_ExistOp(V));
              _HilPack_StackSTR_Push(Op,U);
              _HilPack_General_DelStrNum(S,_HilPack_General_LongStr(U)-1);
              if (!_HilPack_General_SameStr(S,"")){
                 _HilPack_StackSTR_Push(Val,S);
                 _HilPack_General_CopyStr(S,"");
              }
          }
          else
              _HilPack_General_AddChr(S,InputS[L]);
      }
      L++;
      if ((L==_HilPack_General_LongStr(InputS))&&(_HilPack_General_LongStr(S)>0)){
          _HilPack_StackSTR_Push(Val,S);
          }
   }
}

int _HilPack_Excel_ParseID(_HilPack_StackINT *IVal, _HilPack_StackINT *IOp, _HilPack_StackINT *LocOp,char *InputS){
   int L=0;
   int Kurung=0;
   char S[20]="",T[20],U[20],V[20],W[20],Before='x';
   while (L<_HilPack_General_LongStr(InputS)){
      _HilPack_General_CopyStr(T,S);
      _HilPack_General_AddChr(T,InputS[L]);
      _HilPack_General_CopyStr(V,S);
      _HilPack_Excel_GetOp(W,_HilPack_Excel_ExistOp(V));
      _HilPack_General_AddChr(V,InputS[L]);
      _HilPack_Excel_GetOp(U,_HilPack_Excel_ExistOp(V));
   //   printf("%s\n",T);
     // printf("%s\n",S);  
      if (InputS[L]==' '){                             // Karakter kosong
          if ((Before!=' ')&&(Before!='x')){
             if ((_HilPack_Excel_IsOp(S))&&(!((_HilPack_General_SameStr(W,"SQR"))&&(InputS[L]=='T')))){
                 
                // PushS(Op,S);
                if (_HilPack_General_SameStr(S,"(")){
                   Kurung++;
                   _HilPack_StackINT_Push(IOp, Kurung); 
                   _HilPack_StackINT_Push(LocOp,L);
                }
                else if (_HilPack_General_SameStr(S,")")){
                   _HilPack_StackINT_Push(IOp, Kurung);  
                   _HilPack_StackINT_Push(LocOp,L);
                   Kurung--;
                }
                else{
                   _HilPack_StackINT_Push(IOp, -1);  
                   _HilPack_StackINT_Push(LocOp,L); 
                }
                
                 _HilPack_General_CopyStr(S,"");      
             }
             else {
               // PushS(Val,S);
               _HilPack_StackINT_Push(IVal,L);
               _HilPack_General_CopyStr(S,""); 
             }
          }
      }
      else if (_HilPack_Excel_IsOp(T)&&(!((_HilPack_General_SameStr(U,"SQR"))&&(InputS[L+1]=='T')))){                                 // bukan karakter kosong
       /*   if (!SameStr(T,"SQR")){
             PushS(Op,T); 
             CopyStr(S,""); 
          }   
          else if (InputS[L+1]!='T'){
             PushS(Op,T); 
             CopyStr(S,"");   
          }
          else*/ if (_HilPack_Excel_IsOp(T)){
             //PushS(Op,T);
             if (_HilPack_General_SameStr(T,"(")){
                   Kurung++;
                   _HilPack_StackINT_Push(IOp, Kurung);  
                   _HilPack_StackINT_Push(LocOp,L+1);
                }
                else if (_HilPack_General_SameStr(T,")")){
                   _HilPack_StackINT_Push(IOp, Kurung);  
                   _HilPack_StackINT_Push(LocOp,L+1);
                   Kurung--;
                }
                else{
                   _HilPack_StackINT_Push(IOp, -1);   
                   _HilPack_StackINT_Push(LocOp,L+1);
                }
             _HilPack_General_CopyStr(S,"");      
          }
          else {
             _HilPack_General_CopyStr(T,"");
             _HilPack_General_AddChr(T,InputS[L]);
             if (_HilPack_Excel_IsOp(T)){
                 if (_HilPack_General_LongStr(S)>0){
                     if (_HilPack_Excel_IsNumber(S))
               //      PushS(Val,S);
                        _HilPack_StackINT_Push(IVal,L);
                        _HilPack_General_CopyStr(S,"");
                 }
                 //PushS(Op,T); 
                 if (_HilPack_General_SameStr(T,"(")){
                   Kurung++;
                   _HilPack_StackINT_Push(IOp, Kurung);  
                   _HilPack_StackINT_Push(LocOp,L+1);
                }
                else if (_HilPack_General_SameStr(T,")")){
                   _HilPack_StackINT_Push(IOp, Kurung);  
                   _HilPack_StackINT_Push(LocOp,L+1);
                   Kurung--;
                }
                else{
                   _HilPack_StackINT_Push(IOp, -1);  
                   _HilPack_StackINT_Push(LocOp,L+1); 
                }
                
                 _HilPack_General_CopyStr(T,"");          
             }
             else
                _HilPack_General_AddChr(S,InputS[L]);
          }
      }
      else {
          _HilPack_General_CopyStr(T,"");
          _HilPack_General_AddChr(T,InputS[L]);
          
          if (_HilPack_Excel_IsOp(T)){
              if (_HilPack_General_LongStr(S)>0){
                 // PushS(Val,S);
                 _HilPack_StackINT_Push(IVal,L);
                  _HilPack_General_CopyStr(S,"");
              }
             // PushS(Op,T); 
              if (_HilPack_General_SameStr(T,"(")){
                   Kurung++;
                   _HilPack_StackINT_Push(IOp, Kurung);  
                   _HilPack_StackINT_Push(LocOp,L+1);
                }
                else if (_HilPack_General_SameStr(T,")")){
                   _HilPack_StackINT_Push(IOp, Kurung); 
                   Kurung--; 
                   _HilPack_StackINT_Push(LocOp,L+1);
                }
                else{
                   _HilPack_StackINT_Push(IOp, -1);   
                   _HilPack_StackINT_Push(LocOp,L+1);
                }
                
              _HilPack_General_CopyStr(T,"");          
          }
          else if ((_HilPack_Excel_ExistOp(V)!=-1)&&(!((_HilPack_General_SameStr(U,"SQR"))&&(InputS[L+1]=='T')))){
            // printf("duh %s\n",V);          
              _HilPack_Excel_GetOp(U,_HilPack_Excel_ExistOp(V));
           //   printf("kenapa ?\n");
            //  PushS(Op,U);
              if (_HilPack_General_SameStr(U,"(")){
                   Kurung++;
                   _HilPack_StackINT_Push(IOp, Kurung); 
                   _HilPack_StackINT_Push(LocOp,L+1); 
                }
                else if (_HilPack_General_SameStr(U,")")){
                   _HilPack_StackINT_Push(IOp, Kurung); 
                   Kurung--; 
                   _HilPack_StackINT_Push(LocOp,L+1);
                }
                else{
                   _HilPack_StackINT_Push(IOp, -1);  
                   _HilPack_StackINT_Push(LocOp,L+1); 
                }
              _HilPack_General_DelStrNum(S,_HilPack_General_LongStr(U)-1);
              if (!_HilPack_General_SameStr(S,"")){
                // PushS(Val,S);
                 _HilPack_StackINT_Push(IVal,L);
                 _HilPack_General_CopyStr(S,"");
              }
          }
          else
              _HilPack_General_AddChr(S,InputS[L]);
        //  printf("ini dia %s\n",V);
      }
      L++;
      if ((L==_HilPack_General_LongStr(InputS))&&(_HilPack_General_LongStr(S)>0)){
         // PushS(Val,S);
         _HilPack_StackINT_Push(IVal,L);
          }
   }
}

int _HilPack_Excel_Eval(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char *OutputS,char *InputS){
    //  char Kamus[20][10]={")","SQRT","SQR","^","*","/","DIV","MOD","-","+","("};
    //  int Total=11;
    char Temporary[100],Temp1[100],Temp2[100];
    _HilPack_StackSTR Val, Op, SVal, SOp, Temp;
    _HilPack_StackINT IVal, IOp, LocOp, ITemp, PVal, POp, PLocOp;
    int L,Indeks,buff,I,J,K,Loc,ILoc, IAngka, INext, ITanda, LocTanda, LocNext;
    float  F,G;
    int Bar1,Kol1,Bar2,Kol2,KolL,BarL;
    char One[100], Two[100], Three[100], Check[100];
    int B1,B2;
    int Kurung=0,LokasiKur,IndeksKur;
    int Adding=0,Akhir;
    int STOP=0;
    char Tanda[100], Angka[100], Next[100];
    char S[100]="tuvwxyz",T[100],Str[100];
    char Idx[100];
    
    _HilPack_Excel_FilterForm(InputS);
   // _HilPack_General_CopyStr(S,"");
   // _HilPack_General_AddChr(S,'h');
   // printf("%s %d",S,LongStr(S));
   
    _HilPack_StackSTR_CreateEmpty(&Val,100);
    _HilPack_StackSTR_CreateEmpty(&Op,100);
    _HilPack_StackSTR_CreateEmpty(&SVal,100);
    _HilPack_StackSTR_CreateEmpty(&SOp,100);
    _HilPack_StackSTR_CreateEmpty(&Temp,100);
    _HilPack_StackINT_CreateEmpty(&IVal,100);
    _HilPack_StackINT_CreateEmpty(&IOp,100);
    _HilPack_StackINT_CreateEmpty(&LocOp,100);
    _HilPack_StackINT_CreateEmpty(&ITemp,100);
    _HilPack_StackINT_CreateEmpty(&PVal,100);
    _HilPack_StackINT_CreateEmpty(&POp,100);
    _HilPack_StackINT_CreateEmpty(&PLocOp,100);
    
    
    _HilPack_General_ParseStr(Idx, InputS);
    _HilPack_Excel_Parse(&Val,&Op,InputS);
    _HilPack_Excel_ParseID(&IVal, &IOp, &LocOp,InputS);
    
    /*while (!_HilPack_StackSTR_IsEmpty(Op)){
        _HilPack_StackSTR_Pop(&Op,&S); 
        printf("%s\n",S);
    }*/
    
    while (!_HilPack_StackSTR_IsEmpty(Op)){
          _HilPack_StackSTR_Pop(&Val, &Angka);
          _HilPack_StackINT_Pop(&IVal, &IAngka);
        /*  if (!IsNumber(Angka)){
          printf("test");
             _HilPack_StackSTR_Pop(&Val, &Angka);
             }*/
          _HilPack_StackSTR_Pop(&Op, &Tanda);
          _HilPack_StackINT_Pop(&IOp, &ITanda);
          _HilPack_StackINT_Pop(&LocOp, &LocTanda);
          
          if (_HilPack_StackSTR_IsEmpty(Op))
             STOP=1;
          Kurung=0;
          if(_HilPack_General_SameStr(Tanda,")"))
               Kurung++;
          
          _HilPack_General_CopyStr(Next,"");
          if (!_HilPack_StackSTR_IsEmpty(Op)){
             _HilPack_StackSTR_Pop(&Op, &Next);
             _HilPack_StackINT_Pop(&IOp, &INext);
             _HilPack_StackINT_Pop(&LocOp, &LocNext);
          }
          while ((_HilPack_Excel_Preced(Next)<_HilPack_Excel_Preced(Tanda))&&(!STOP)){
                                   _HilPack_StackSTR_Push(&SVal, Angka);
                                   _HilPack_StackSTR_Push(&SOp, Tanda);
                                   _HilPack_StackINT_Push(&PVal, IAngka);
                                   _HilPack_StackINT_Push(&POp, ITanda);
                                   _HilPack_StackINT_Push(&PLocOp, LocTanda);
                                   _HilPack_General_CopyStr(Tanda, Next);
                                   ITanda=INext;
                                   LocTanda=LocNext;
                                   if(_HilPack_General_SameStr(Tanda,")"))
                                       Kurung++;
                                   _HilPack_StackSTR_Pop(&Val, &Angka);               
                                   _HilPack_StackSTR_Pop(&Op, &Next);
                                   _HilPack_StackINT_Pop(&IVal, &IAngka);               
                                   _HilPack_StackINT_Pop(&IOp, &INext);
                                   _HilPack_StackINT_Pop(&LocOp, &LocNext);            
          }
        //  printf("coba %d %d %s\n",_HilPack_StackSTR_Top(Val),_HilPack_StackSTR_Top(Op),Tanda);
          switch (_HilPack_Excel_Preced(Tanda)){
              case 0 :{
              //   printf("lewat %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 _HilPack_StackSTR_Push(&Op,Next);
                 _HilPack_StackINT_Push(&IOp,INext);
                 _HilPack_StackINT_Push(&LocOp,LocNext);
                 
                 //Tanda=10;
                 
                 LokasiKur=LocTanda-1;
                 IndeksKur=ITanda;
             //    printf("lokasi %d  indeks %d\n",LokasiKur,IndeksKur);
                 _HilPack_General_CopyStr(Tanda,Next);
                 ITanda=INext;
                 LocTanda=LocNext;
                 
                 Indeks=_HilPack_StackSTR_Top(Op)+1;

                 /*while (Indeks<Top(IOp)){
                     _HilPack_StackINT_Pop(&LocOp,&buff);   
                     _HilPack_StackINT_Pop(&IOp,&buff);  
                 }*/
                 
                 //_HilPack_StackINT_Pop(&LocOp,&Loc);
                 //_HilPack_StackINT_Pop(&IOp,&buff);
                     
                 J=LokasiKur-1;
                 while (Idx[J]!=IndeksKur){
             //       printf("j=%d\n",J);
                    J--;   
                 }
                 
                 _HilPack_General_GetStr(Str,InputS,J+1,LokasiKur-1);
                 
               //  printf("getstr %s\n",Str);
                 
                 
                 
                 
                 
                 while (!_HilPack_StackSTR_IsEmpty(Val)){
                 //    printf("isinya %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));  
                     _HilPack_StackSTR_Pop (&Val, &Angka); 
                     _HilPack_StackINT_Pop (&IVal, &IAngka);
                     if (!(((IAngka-1)>=(J+1))&&((IAngka-1)<(LokasiKur)))){
                                                            
                      //   printf("cilok %d %d %d\n",(J+1),(Loc-2),ILoc);
                      //   printf("");
                         _HilPack_StackSTR_Push(&Temp, Angka);
                         _HilPack_StackINT_Push(&ITemp, IAngka);
                     }
                 }
              //   printf("%d %d\n",_HilPack_StackSTR_Top(Val),_HilPack_StackSTR_Top(Op));
              //   
                 while (!_HilPack_StackSTR_IsEmpty(Temp)){
                     _HilPack_StackSTR_Pop (&Temp, &Angka); 
                     _HilPack_StackINT_Pop (&ITemp, &IAngka);
                         _HilPack_StackSTR_Push(&Val, Angka);
                         _HilPack_StackINT_Push(&IVal, IAngka);
                 }
             //    printf("%d %d\n",_HilPack_StackSTR_Top(Val),_HilPack_StackSTR_Top(Op));
                 
                 Akhir=buff;
                 _HilPack_StackSTR_Pop(&Op,&Tanda);  
                 _HilPack_StackINT_Pop(&LocOp,&LocTanda);   
                 _HilPack_StackINT_Pop(&IOp,&ITanda); 
                 while (ITanda!=IndeksKur){
                     _HilPack_StackSTR_Pop(&Op,&Tanda);  
                     _HilPack_StackINT_Pop(&LocOp,&LocTanda);   
                     _HilPack_StackINT_Pop(&IOp,&ITanda);  
                 }
                 
             //    printf("getstr %s %s\n",Str,Tanda);
                 Indeks=0;
                 if (!_HilPack_StackSTR_IsEmpty(Op)){
                     Indeks=1;              
                     _HilPack_StackSTR_Pop(&Op,&Next);  
                     _HilPack_StackINT_Pop(&LocOp,&LocNext);   
                     _HilPack_StackINT_Pop(&IOp,&INext);               
                 }
                 
                // _HilPack_General_CopyStr(Next)
                 if (_HilPack_Excel_ExistUnikOp(Next)!=-1){
                     buff=_HilPack_Excel_ExistUnikOp(Next); 
                     if ( (_HilPack_Excel_ExistUnikOp(Next)==7)&&(_HilPack_General_SameStr(Next,"SQRT")) )
                        buff++;
                   //  printf("masuk %d\n",buff);                   
                     switch (buff){
                         case 0 : {  //sum
                            _HilPack_General_CopyStr(Temp1,"");
                            K=0;
                            _HilPack_General_ParseArea(&Kol1,&Bar1,&Kol2,&Bar2,Str);
                            for (BarL=Bar1;BarL<=Bar2;BarL++){
                               for (KolL=Kol1;KolL<=Kol2;KolL++){
                                   if (Matriks[KolL][BarL].type>0){
                                       if ((KolL==Kol1)&&(BarL==Bar1))
                                           sprintf(Temp2,"%c%d",(char)(KolL+64),BarL);
                                       else
                                           sprintf(Temp2,"+%c%d",(char)(KolL+64),BarL);
                                       K++;
                                       _HilPack_General_AddStr(Temp1,Temp2);
                                   }
                               }
                            }
                            
                            _HilPack_Excel_Eval(Matriks,Str,Temp1);
                         }  break; 
                         case 1 : {  //average
                            _HilPack_General_CopyStr(Temp1,"");
                            K=0;
                            _HilPack_General_ParseArea(&Kol1,&Bar1,&Kol2,&Bar2,Str);
                            for (BarL=Bar1;BarL<=Bar2;BarL++){
                               for (KolL=Kol1;KolL<=Kol2;KolL++){
                                   if (Matriks[KolL][BarL].type>0){
                                      // if ((KolL==Kol1)&&(BarL==Bar1))
                                       if (K==0)
                                           sprintf(Temp2,"(%c%d",(char)(KolL+64),BarL);
                                       else
                                           sprintf(Temp2,"+%c%d",(char)(KolL+64),BarL);
                                       K++;
                                       _HilPack_General_AddStr(Temp1,Temp2);
                                   }
                               }
                            }
                            sprintf(Temp2,")/%d",K);
                            _HilPack_General_AddStr(Temp1,Temp2);
                            _HilPack_Excel_Eval(Matriks,Str,Temp1);
                         }  break; 
                         case 2 : {  //count
                            K=0;
                            _HilPack_General_ParseArea(&Kol1,&Bar1,&Kol2,&Bar2,Str);
                            for (BarL=Bar1;BarL<=Bar2;BarL++){
                               for (KolL=Kol1;KolL<=Kol2;KolL++){
                                   if (Matriks[KolL][BarL].type>0){
                                      // if ((KolL==Kol1)&&(BarL==Bar1))
                                       K++;
                                   }
                               }
                            }
                            sprintf(Temp1,"%d",K);
                            _HilPack_Excel_Eval(Matriks,Str,Temp1);
                         }  break; 
                         case 3 : {  //stdev
                         
                            _HilPack_General_CopyStr(Temp1,"");
                            K=0;
                            _HilPack_General_ParseArea(&Kol1,&Bar1,&Kol2,&Bar2,Str);
                            for (BarL=Bar1;BarL<=Bar2;BarL++){
                               for (KolL=Kol1;KolL<=Kol2;KolL++){
                                   if (Matriks[KolL][BarL].type>0){
                                      // if ((KolL==Kol1)&&(BarL==Bar1))
                                       if (K==0)
                                           sprintf(Temp2,"(%c%d",(char)(KolL+64),BarL);
                                       else
                                           sprintf(Temp2,"+%c%d",(char)(KolL+64),BarL);
                                       K++;
                                       _HilPack_General_AddStr(Temp1,Temp2);
                                   }
                               }
                            }
                            sprintf(Temp2,")/%d",K);
                            _HilPack_General_AddStr(Temp1,Temp2);
                            _HilPack_Excel_Eval(Matriks,Temporary,Temp1);
                            L=K;
                            
                            _HilPack_General_CopyStr(Temp1,"");
                            K=0;
                            _HilPack_General_ParseArea(&Kol1,&Bar1,&Kol2,&Bar2,Str);
                            for (BarL=Bar1;BarL<=Bar2;BarL++){
                               for (KolL=Kol1;KolL<=Kol2;KolL++){
                                   if (Matriks[KolL][BarL].type>0){
                                      // if ((KolL==Kol1)&&(BarL==Bar1))
                                       if (K==0)
                                           sprintf(Temp2,"SQRT(( (%c%d-%s)^2",(char)(KolL+64),BarL,Temporary);
                                       else
                                           sprintf(Temp2,"+(%c%d-%s)^2",(char)(KolL+64),BarL,Temporary);
                                       K++;
                                       _HilPack_General_AddStr(Temp1,Temp2);
                                   }
                               }
                            }
                            
                            if (L==1)
                               L++;
                               
                            sprintf(Temp2,")/%d)",L-1);
                            _HilPack_General_AddStr(Temp1,Temp2);

                            _HilPack_Excel_Eval(Matriks,Str,Temp1);
                         }  break; 
                         case 4 : {  //max
                            _HilPack_General_CopyStr(Temp1,"");
                            K=0;

                            _HilPack_General_ParseArea(&Kol1,&Bar1,&Kol2,&Bar2,Str);
                            for (BarL=Bar1;BarL<=Bar2;BarL++){
                               for (KolL=Kol1;KolL<=Kol2;KolL++){
                                   if (Matriks[KolL][BarL].type>0){
                                       if (K==0){
                                           sprintf(Temp1,"%c%d",(char)(KolL+64),BarL);
                                           _HilPack_Excel_Eval(Matriks,Temporary, Temp1);
                                       }
                                       else{
                                           sprintf(Temp2,"%c%d",(char)(KolL+64),BarL);
                                           _HilPack_Excel_Eval(Matriks,Temp1,Temp2);
                                           if (atof(Temp1)>atof(Temporary))
                                               _HilPack_Excel_Eval(Matriks,Temporary, Temp1);
                                       }
                                       K++;
                                   }
                               }
                            }
                            _HilPack_Excel_Eval(Matriks,Str,Temporary);
                         }  break; 
                         case 5 : {  //max
                            _HilPack_General_CopyStr(Temp1,"");
                            K=0;

                            _HilPack_General_ParseArea(&Kol1,&Bar1,&Kol2,&Bar2,Str);
                            for (BarL=Bar1;BarL<=Bar2;BarL++){
                               for (KolL=Kol1;KolL<=Kol2;KolL++){
                                   if (Matriks[KolL][BarL].type>0){
                                       if (K==0){
                                           sprintf(Temp1,"%c%d",(char)(KolL+64),BarL);
                                           _HilPack_Excel_Eval(Matriks,Temporary, Temp1);
                                       }
                                       else{
                                           sprintf(Temp2,"%c%d",(char)(KolL+64),BarL);
                                           _HilPack_Excel_Eval(Matriks,Temp1,Temp2);
                                           if (atof(Temp1)<atof(Temporary))
                                               _HilPack_Excel_Eval(Matriks,Temporary, Temp1);
                                       }
                                       K++;
                                   }
                               }
                            }
                            _HilPack_Excel_Eval(Matriks,Str,Temporary);
                         }  break; 
                         case 6 : {
                              _HilPack_General_ParseThree(One,Two,Three,Str);
                              _HilPack_Excel_Eval(Matriks,Temporary, One);
                              if (_HilPack_General_SameStr(Temporary,"TRUE")){
                                  _HilPack_Excel_Eval(Matriks,Str,Two); 
                              }
                              else
                                  _HilPack_Excel_Eval(Matriks,Str,Three);
                         }   break;
                         case 7 : {  //sqr
                              
                              _HilPack_Excel_Eval(Matriks,Temporary,Str);
                              sprintf(Str,"%.3f",pow(atof(Temporary),2));
                         } break;
                         case 8 : {  //sqrt;
                              _HilPack_Excel_Eval(Matriks,Temporary,Str);
                              sprintf(Str,"%.3f",sqrt(atof(Temporary)));
                         } break; 
                         case 9 : {
                              _HilPack_General_ParseTwo(One,Two,Str);
                              _HilPack_General_CopyStr(S,One);
                              _HilPack_General_AddStr(S,Two);
                              sprintf(Str,"%s",S); 
                         }break;
                         case 10 : {   // MOD
                            _HilPack_General_ParseTwo(One,Two,Str);
                            _HilPack_Excel_Eval(Matriks,Temp1,One);
                            _HilPack_Excel_Eval(Matriks,Temp2,Two);
                            sprintf(Str,"%.3f",fmod(atof(Temp1),atof(Temp2)));  
                         } break;
                         case 11 : {   // DIV
                            _HilPack_General_ParseTwo(One,Two,Str);
                            _HilPack_Excel_Eval(Matriks,Temp1,One);
                            _HilPack_Excel_Eval(Matriks,Temp2,Two);
                            sprintf(Str,"%.3f",floor(atof(Temp1)/atof(Temp2)));  
                         } break;
                         case 12 : {   // AND
                            _HilPack_General_ParseTwo(One,Two,Str);
                            _HilPack_Excel_Eval(Matriks,Temp1,One);
                            _HilPack_Excel_Eval(Matriks,Temp2,Two);
                            B1=(_HilPack_General_SameStr(Temp1,"TRUE"));
                            B2=(_HilPack_General_SameStr(Temp2,"TRUE"));
                            if (B1&&B2)
                               sprintf(Str,"%s","TRUE");
                            else 
                               sprintf(Str,"%s","FALSE");
                           // if (); 
                         } break;
                         case 13 : {  // OR
                            _HilPack_General_ParseTwo(One,Two,Str);
                            _HilPack_Excel_Eval(Matriks,Temp1,One);
                            _HilPack_Excel_Eval(Matriks,Temp2,Two);
                            B1=(_HilPack_General_SameStr(Temp1,"TRUE"));
                            B2=(_HilPack_General_SameStr(Temp2,"TRUE"));
                            if (B1||B2)
                               sprintf(Str,"%s","TRUE");
                            else 
                               sprintf(Str,"%s","FALSE");
                         } break;
                         case 14 : {  // NOT
                            _HilPack_Excel_Eval(Matriks,Temporary,Str);
                            B1=(_HilPack_General_SameStr(Temporary,"TRUE"));
                            if (!B1)
                               sprintf(Str,"%s","TRUE");
                            else 
                               sprintf(Str,"%s","FALSE");
                         } break;
                     }
                 }
                 else{
                     if (Indeks){ 
                        _HilPack_StackSTR_Push(&Op,Next);  
                        _HilPack_StackINT_Push(&LocOp,LocNext);   
                        _HilPack_StackINT_Push(&IOp,INext);
                     } 
                     _HilPack_Excel_Eval(Matriks,Temporary,Str);
                     sprintf(Str,"%.3f",atof(Temporary));
                 }
                 _HilPack_StackSTR_Push(&Val,Str);
                 _HilPack_StackINT_Push(&IVal,-1);
              //   printf("selesai %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal),_HilPack_StackSTR_Top(Op));
               // printf("kurung %s\n",);
              } break;
              case 4 : { // ^
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else 
                    F=atof(S);
                    
                 if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
                 
                 sprintf(T,"%.3f",pow(F,G));
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;   
              case 5 : {  // *
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else 
                    F=atof(S);
                    
                 if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
                 
                 sprintf(T,"%.3f",F*G);
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 } 
                    
              } break;
              case 6 : {  //  /
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else 
                    F=atof(S);
                    
                 if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
                 
                 sprintf(T,"%.3f",F/G);
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;
              
              case 10 : {// +
                 
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                 //   _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temp1);
                 }
                 else 
                    F=atof(S);
                    
                 if (_HilPack_General_IsCell(Angka)){
                    
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                  //  printf("hei %s\n",Temp1);
                 ///   _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temp1);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
              //   printf("%.1f %.1f\n",F,G);
              //   printf("%s %s\n",S,Angka);
                 sprintf(T,"%.3f",F+G);
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;
              case 9 : {   // -
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else 
                    F=atof(S);
                    
                if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
                 
                 sprintf(T,"%.3f",F-G);
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;
              case 17 : {   // >
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else {
                      
                    F=atof(S);
                 }
                 if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else {
                    G=atof(Angka);
                 }
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
             
                 if (F>G)
                    sprintf(T,"%s","TRUE");
                 else
                    sprintf(T,"%s","FALSE");
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;
              case 18 : {   // <
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else 
                    F=atof(S);
                    
                 if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
                 
                 if (F<G)
                    sprintf(T,"%s","TRUE");
                 else
                    sprintf(T,"%s","FALSE");
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;
              case 19 : {   // >=  ]>
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else 
                    F=atof(S);
                    
                 if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
                 
                 if (F>=G)
                    sprintf(T,"%s","TRUE");
                 else
                    sprintf(T,"%s","FALSE");
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;
              case 20 : {   // <=
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else 
                    F=atof(S);
                    
                 if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
                 
                 if (F<=G)
                    sprintf(T,"%s","TRUE");
                 else
                    sprintf(T,"%s","FALSE");
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;
              case 21 : {   // !=
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else 
                    F=atof(S);
                    
                 if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
                 
                 if (!_HilPack_General_SameStr(S,Angka))
                    sprintf(T,"%s","TRUE");
                 else
                    sprintf(T,"%s","FALSE");
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;
              case 22 : {   // ==
                 _HilPack_StackSTR_Pop(&Val, &S);  
                 _HilPack_StackINT_Pop(&IVal, &IAngka);
                 
               //  printf("atas %d %d\n",_HilPack_StackSTR_Top(Val),Top(IVal));
                 
                 if (_HilPack_General_IsCell(S)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,S);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    F=atof(Temporary);
                 }
                 else 
                    F=atof(S);
                    
                 if (_HilPack_General_IsCell(Angka)){
                    _HilPack_Excel_EvalCell(Matriks,Temp1,Angka);            
                    _HilPack_Excel_Eval(Matriks,Temporary, Temp1);            
                    G=atof(Temporary);
                 }
                 else 
                    G=atof(Angka);
                 
               //  printf("tes %s %d %s %d ",S,_HilPack_General_IsCell(S),Angka,_HilPack_General_IsCell(Angka));
                 
                 if (_HilPack_General_SameStr(S,Angka))
                    sprintf(T,"%s","TRUE");
                 else
                    sprintf(T,"%s","FALSE");
                 _HilPack_StackSTR_Push(&Val, T);
                 _HilPack_StackINT_Push(&IVal, -1);
                 if (!STOP){
                    _HilPack_StackSTR_Push(&Op, Next);
                    _HilPack_StackINT_Push(&IOp, INext);
                    _HilPack_StackINT_Push(&LocOp, LocNext);
                 }
              } break;
          }
          
          while (!_HilPack_StackSTR_IsEmpty(SVal)){
                     _HilPack_StackSTR_Pop(&SVal, &Angka);
                     _HilPack_StackINT_Pop(&PVal, &IAngka);
                     _HilPack_StackSTR_Push(&Val, Angka);
                     _HilPack_StackINT_Push(&IVal, IAngka);
          }
          while (!_HilPack_StackSTR_IsEmpty(SOp)){
                     _HilPack_StackSTR_Pop(&SOp, &Tanda);
                     _HilPack_StackINT_Pop(&POp, &ITanda);
                     _HilPack_StackINT_Pop(&PLocOp, &LocTanda);
                     _HilPack_StackSTR_Push(&Op, Tanda);
                     _HilPack_StackINT_Push(&IOp, ITanda);
                     _HilPack_StackINT_Push(&LocOp, LocTanda);
          }
          
    }
    
   _HilPack_StackSTR_Pop(&Val,&S);
   if (_HilPack_General_IsCell(S)){
      _HilPack_Excel_EvalCell(Matriks,Temporary,S);
      _HilPack_General_CopyStr(OutputS,Temporary);
   }
   else {
      _HilPack_General_CopyStr(OutputS,S);
      
   }
}


int _HilPack_Excel_EvalCell(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char *OutputS, char *InputS){
   int Baris,Kolom;
   char Temporary[100];
   _HilPack_General_ParseCell(&Kolom,&Baris,InputS);
   if (Matriks[Kolom][Baris].type==3){
       _HilPack_Excel_Eval(Matriks,Temporary,Matriks[Kolom][Baris].value.TabKata);
   }
   else
      _HilPack_General_CopyStr(Temporary,Matriks[Kolom][Baris].value.TabKata);
   _HilPack_General_CopyStr(OutputS,Temporary);
}

int _HilPack_Excel_EvalNoMatrix(char *OutputS,char *InputS){
    _HilPack_Excel_Eval(_HilPack_Excel_Matriks,OutputS,InputS);
}

char *_HilPack_Excel_PrintEval(_HilPack_Excel_cell Matriks[_HilPack_Excel_MaxKolom+1][_HilPack_Excel_MaxBaris+1], char *InputS){
    char OutputS[100];
    _HilPack_Excel_Eval(Matriks,OutputS,InputS);
    return OutputS;
}

char *_HilPack_Excel_PrintEvalNoMatrix(char *InputS){
    char OutputS[100];
    _HilPack_Excel_EvalNoMatrix(OutputS,InputS);
    return OutputS;
}
//-----------------------------------------------------------------------
// _HilPack_Set_INT

int _HilPack_Set_INT_CreateSetINT(_HilPack_Set_INT *InSet,int Size){ // Membuat set kosong dengan size tertentu
    (*InSet).Data=(int*)malloc((Size+5)*sizeof(int));
    if ((*InSet).Data!=0){
       (*InSet).Top=0;
       (*InSet).Size=Size;
       return 1;
    }
    else {
       (*InSet).Top=0;  
       (*InSet).Size=0;
       return 0;
    }
}

int _HilPack_Set_INT_DeleteSetINT(_HilPack_Set_INT *InSet){
    (*InSet).Top=0;
}

// bila set kosong-> return 1, bila ada isinya -> return 0 
int _HilPack_Set_INT_NoSetINT(_HilPack_Set_INT InSet){ 
    return (InSet.Top==0);
}

// bila set penuh-> return 1, bila ada isinya -> return 0 
int _HilPack_Set_INT_FullSetINT(_HilPack_Set_INT InSet){
    return  (InSet.Top>=InSet.Size);
}

// Mengecek apakah value merupakan bagian dari set, return posisi angka jika ya, return 0 jika tidak
int _HilPack_Set_INT_ExistSetINT(_HilPack_Set_INT InSet, int Value){ 
    int L,Found=0;
    if (_HilPack_Set_INT_NoSetINT(InSet))
        return 0;
    else {
       for (L=1;L<=InSet.Top;L++){
           if (InSet.Data[L]==Value){
               Found=L;                      
               L=InSet.Top+1;
           }
       }  
       return Found;
    }
}

// Menambahkan angka pada set, return posisi angka jika berhasil, return 0 jika gagal (angka sudah ada di set, atau sudah penuh)
int _HilPack_Set_INT_AddSetINT(_HilPack_Set_INT *InSet, int Value){ 
    if (_HilPack_Set_INT_ExistSetINT(*InSet,Value)||_HilPack_Set_INT_FullSetINT(*InSet))
       return 0;
    else {
       (*InSet).Top++;
       (*InSet).Data[(*InSet).Top]=Value;
       return (*InSet).Top;  
    }
}

// Mengurangkan angka pada set, return 1 jika berhasil, return 0 jika gagal (angka tidak ada di set)
int _HilPack_Set_INT_DelSetINT(_HilPack_Set_INT *InSet, int Value){
    int L,Loc=_HilPack_Set_INT_ExistSetINT(*InSet, Value);
    if (Loc<=0)
       return 0;
    else {
       for (L=Loc+1;L<=(*InSet).Top;L++){
          (*InSet).Data[L-1]=(*InSet).Data[L];
       }
       (*InSet).Top--;
       return Loc;
    }
}

// Intersection dua set
int _HilPack_Set_INT_ANDSetINT(_HilPack_Set_INT InSet1, _HilPack_Set_INT InSet2, _HilPack_Set_INT *OutSet){
   int Size=(InSet1.Top<=InSet2.Top)?InSet1.Top:InSet2.Top;
   int Num= (InSet1.Top<=InSet2.Top)?1:2;
   int L;
   _HilPack_Set_INT_CreateSetINT(OutSet,Size);
   if (Num==1){
     for (L=1;L<=InSet1.Top;L++){
         if (_HilPack_Set_INT_ExistSetINT(InSet2,InSet1.Data[L])) 
             _HilPack_Set_INT_AddSetINT(OutSet,InSet1.Data[L]);
     }
   }
   else if (Num==2){
     for (L=1;L<=InSet2.Top;L++){
          if (_HilPack_Set_INT_ExistSetINT(InSet1,InSet2.Data[L])) 
             _HilPack_Set_INT_AddSetINT(OutSet,InSet2.Data[L]);
     }
   }
   return 1;
}

int _HilPack_Set_INT_ORSetINT(_HilPack_Set_INT InSet1, _HilPack_Set_INT InSet2, _HilPack_Set_INT *OutSet){
   int Size=InSet1.Top+InSet2.Top;
   int L;
   _HilPack_Set_INT_CreateSetINT(OutSet,Size);
   for (L=1;L<=InSet1.Top;L++)
       _HilPack_Set_INT_AddSetINT(OutSet,InSet1.Data[L]);
   for (L=1;L<=InSet2.Top;L++)
       _HilPack_Set_INT_AddSetINT(OutSet,InSet2.Data[L]);    
   return 1;    
}

// Menggandakan Set, return 1 jika berhasil, return 0 jika InSet kosong
int _HilPack_Set_INT_CopySetINT(_HilPack_Set_INT *OutSet, _HilPack_Set_INT InSet){
    int L,Size=InSet.Top;
    if (_HilPack_Set_INT_NoSetINT(InSet))
       return 0;
    else {
       _HilPack_Set_INT_CreateSetINT(OutSet,Size);
       for (L=1;L<=InSet.Top;L++)
          _HilPack_Set_INT_AddSetINT(OutSet,InSet.Data[L]);
       return 1;
    }
}

int _HilPack_Set_INT_CopySetINTSize(_HilPack_Set_INT *OutSet, _HilPack_Set_INT InSet, int SetSize){
    int L,Size=SetSize;
    if (_HilPack_Set_INT_NoSetINT(InSet))
       return 0;
    else {
       _HilPack_Set_INT_CreateSetINT(OutSet,Size);
       for (L=1;L<=InSet.Top;L++)
          _HilPack_Set_INT_AddSetINT(OutSet,InSet.Data[L]);
       return 1;
    }
}

// Gabungan 2 set
int _HilPack_Set_INT_PlusSetINT(_HilPack_Set_INT InSet1, _HilPack_Set_INT InSet2, _HilPack_Set_INT *OutSet){
    _HilPack_Set_INT_ORSetINT(InSet1, InSet2, OutSet);
    return 1;
} 

// Set 1 dikurangi set 2
int _HilPack_Set_INT_MinusSetINT(_HilPack_Set_INT InSet1, _HilPack_Set_INT InSet2, _HilPack_Set_INT *OutSet){
    int L;
    _HilPack_Set_INT_CopySetINT(OutSet, InSet1);
    for (L=1;L<=InSet2.Top;L++)
       _HilPack_Set_INT_DelSetINT(OutSet,InSet2.Data[L]);
}

// Gabungan 2 set
int _HilPack_Set_INT_PlusSetInINT(_HilPack_Set_INT *InSet1, _HilPack_Set_INT InSet2){
    int L;
    for (L=1;L<=InSet2.Top;L++)
       _HilPack_Set_INT_AddSetINT(InSet1,InSet2.Data[L]);
}

// Set 1 dikurangi set 2
int _HilPack_Set_INT_MinusSetInINT(_HilPack_Set_INT *InSet1, _HilPack_Set_INT InSet2){
    int L;
    for (L=1;L<=InSet2.Top;L++)
       _HilPack_Set_INT_DelSetINT(InSet1,InSet2.Data[L]);
}

int _HilPack_Set_INT_PrintSetINT(_HilPack_Set_INT InSet){
    int L;
    if (_HilPack_Set_INT_NoSetINT(InSet))
        return 0;
    else {
        for (L=1;L<=InSet.Top;L++)
           printf(" %d : %d\n",L,InSet.Data[L]);
        return InSet.Top ;  
    }
}

//-----------------------------------------------------------------------
// _HilPack_Hash_STR

int _HilPack_Hash_STR_DeleteHashSTR(_HilPack_Hash_STR *H){
    if ((*H).Top==0)
       return 0;
    else{
      (*H).Top=0;
      return 1;
    }
}

int _HilPack_Hash_STR_EmptyHashSTR(_HilPack_Hash_STR H){
    return (H.Top==0);
}
int _HilPack_Hash_STR_FullHashSTR(_HilPack_Hash_STR H){
    return (H.Top==_HilPack_Hash_STR_Size);
}
int _HilPack_Hash_STR_GetSTRHashSTR(_HilPack_Hash_STR H, int InIdx, char *OutH){
    int L;
    if (InIdx>H.Top)
        return 0;
    else {
        _HilPack_General_CopyStr(OutH,H.Data[InIdx]);
        return _HilPack_General_LongStr(OutH);
    }
}
int _HilPack_Hash_STR_GetIdxHashSTR(_HilPack_Hash_STR H, char *InSTR){
    int L,Found=0;
    if (_HilPack_Hash_STR_EmptyHashSTR(H))
       return 0;
    else {
       for (L=1;L<=H.Top;L++){
          if  (_HilPack_General_SameStr(H.Data[L],InSTR)){
              Found=L;
              L=H.Top+1;
          }
       }   
       return Found;
    }
}
int _HilPack_Hash_STR_AddHashSTR(_HilPack_Hash_STR *H, char *InSTR){
    if (_HilPack_Hash_STR_FullHashSTR(*H))
       return 0;
    else {
       (*H).Top++;
       _HilPack_General_CopyStr((*H).Data[(*H).Top],InSTR);  
       return (*H).Top;
    }
}

int _HilPack_Hash_STR_DelNumHashSTR(_HilPack_Hash_STR *H, int Idx){
    int L;
    if ((Idx>(*H).Top)||(Idx==0))
       return 0;
    else {
        for (L=Idx+1;L<=(*H).Top;L++)
            _HilPack_General_CopyStr((*H).Data[L-1],(*H).Data[L]); 
        (*H).Top--;
    }
}

int _HilPack_Hash_STR_DelHashSTR(_HilPack_Hash_STR *H, char *InSTR){
    return _HilPack_Hash_STR_DelNumHashSTR(H,_HilPack_Hash_STR_GetIdxHashSTR(*H,InSTR) );
}

int _HilPack_Hash_STR_PrintHashSTR(_HilPack_Hash_STR H){
    int L;
    if (_HilPack_Hash_STR_EmptyHashSTR(H))
       return 0;
    else {
       for (L=1;L<=H.Top;L++)
           printf(" %d : %s\n",L,H.Data[L]);
       return H.Top;    
    }
}

//----------------------------------------------------------------------
// _HilPack_Graph

int _HilPack_Graph_DeleteGraph(_HilPack_Graph *G){
   if ((*G).Total==0)
       return 0;
   else {
      (*G).Total=0; 
      _HilPack_Hash_STR_DeleteHashSTR(&(*G).Node);
       return 1;
   }
}

int _HilPack_Graph_FullGraph(_HilPack_Graph G){
    return (G.Total==_HilPack_Graph_Size);
}

int _HilPack_Graph_EmptyGraph(_HilPack_Graph G){
    return (G.Total==0); 
}

int _HilPack_Graph_ValidNumNode(_HilPack_Graph G, int Node){
    int Max=G.Total;
    return (Node<=Max)&&(Node>0);
}

int _HilPack_Graph_ValidNode(_HilPack_Graph G, char *Name){
    int Node=_HilPack_Hash_STR_GetIdxHashSTR((G).Node,Name);
    return _HilPack_Graph_ValidNumNode(G, Node);
}

int _HilPack_Graph_AddNode(_HilPack_Graph *G, char *Name,float inFloatVal, char *inStrVal, int inIntVal){
    int Top=0,L,M;
    if (_HilPack_Graph_FullGraph(*G))
        return 0;
    else {
        Top=++(*G).Total;
        _HilPack_Hash_STR_AddHashSTR(&(*G).Node,Name);
        (*G).FloatVal[Top]=inFloatVal;
        _HilPack_General_CopyStr((*G).StrVal[Top],inStrVal);
        (*G).IntVal[Top]=inIntVal;
        for (L=1;L<=Top;L++)
           for (M=1;M<=Top;M++){
               if (L==M) 
                   (*G).Data[L][M]=0;
               else
                   (*G).Data[L][M]=-1;
           }
        return Top;
    }
}

int _HilPack_Graph_AddNumNodeTime(_HilPack_Graph *G, int From, int To, float Time, int Direction){
   if (!(_HilPack_Graph_ValidNumNode(*G,From)&&_HilPack_Graph_ValidNumNode(*G,To)))
       return 0;
   else {
       (*G).Data[From][To]=Time;
       if (Direction) {
                      
       }
       else if ((*G).Data[To][From]<=0)
               (*G).Data[To][From]=Time;
       return 1;
   }
}

int _HilPack_Graph_AddNumNodeTimeDirection(_HilPack_Graph *G, int From, int To, float Time){
   return _HilPack_Graph_AddNumNodeTime(G, From, To, Time, 1);
}

int _HilPack_Graph_AddNumNodeTimeNoDirection(_HilPack_Graph *G, int From, int To, float Time){
   return _HilPack_Graph_AddNumNodeTime(G, From, To, Time, 0);
}

int _HilPack_Graph_AddNodeTime(_HilPack_Graph *G, char *From, char *To, float Time, int Direction){
    int ValFrom, ValTo, Result;
    if (!(_HilPack_Graph_ValidNode(*G,From)&&_HilPack_Graph_ValidNode(*G,To)))
        return 0;
    else {
        ValFrom=_HilPack_Hash_STR_GetIdxHashSTR((*G).Node,From);
        ValTo=_HilPack_Hash_STR_GetIdxHashSTR((*G).Node,To);
        if (Direction)
            Result=_HilPack_Graph_AddNumNodeTimeDirection(G, ValFrom, ValTo, Time);
        else
            Result=_HilPack_Graph_AddNumNodeTimeNoDirection(G, ValFrom, ValTo, Time);
        return Result; 
    }    
}

int _HilPack_Graph_AddNodeTimeDirection(_HilPack_Graph *G, char *From, char *To, float Time){
    return _HilPack_Graph_AddNodeTime(G, From, To, Time, 1);
}

int _HilPack_Graph_AddNodeTimeNoDirection(_HilPack_Graph *G, char *From, char *To, float Time){
    return _HilPack_Graph_AddNodeTime(G, From, To, Time, 0);
}

int _HilPack_Graph_DelNumNode(_HilPack_Graph *G, int DelNum){
    int L,M,Total=(*G).Total;
    if (!_HilPack_Graph_ValidNumNode(*G, DelNum))
        return 0;
    else {
       for (L=DelNum+1;L<=Total;L++){
           for (M=1;M<=Total;M++){
               (*G).Data[L-1][M]=(*G).Data[L][M];
           }
           (*G).FloatVal[L-1]=(*G).FloatVal[L];
           (*G).IntVal[L-1]=(*G).IntVal[L];
           _HilPack_General_CopyStr((*G).StrVal[L-1],(*G).StrVal[L]);
       }
       for (M=DelNum+1;M<=Total;M++){
           for (L=1;L<=Total-1;L++){
               (*G).Data[L][M-1]=(*G).Data[L][M];
           }
       }
       _HilPack_Hash_STR_DelNumHashSTR(&(*G).Node, DelNum);
       (*G).Total--;
       return Total;
    }   
}

int _HilPack_Graph_DelNode(_HilPack_Graph *G, char *DelName){
    int L=_HilPack_Hash_STR_GetIdxHashSTR((*G).Node, DelName);
    return _HilPack_Graph_DelNumNode(G,L);
}

int _HilPack_Graph_PrintGraph(_HilPack_Graph G){
    int L,M;
    char Name[100];
    char Retrieve[100];
    if (_HilPack_Graph_EmptyGraph(G))
        return 0;
    else {
        printf("\t"); 
        for (L=1;L<=G.Total;L++){
            _HilPack_Hash_STR_GetSTRHashSTR(G.Node, L, Retrieve);
            printf("|%s\t",Retrieve);
        } 
        printf("\n");
        for (L=1;L<=G.Total;L++){
            _HilPack_Hash_STR_GetSTRHashSTR(G.Node, L, Retrieve);
            printf("%s\t",Retrieve);
            for (M=1;M<=G.Total;M++){
                printf("|%.2f\t",G.Data[L][M]);
            } 
            printf("\n");
        }
        printf("\nIndex\tNama\tFVal\tSVal\tIVal\n");
        for (L=1;L<=G.Total;L++){
            _HilPack_Hash_STR_GetSTRHashSTR(G.Node, L, Retrieve);
            printf("%d :\t%s\t%.5f\t%s\t%d\n",L,Retrieve,G.FloatVal[L],G.StrVal[L],G.IntVal[L]);
        }
    }
}

int _HilPack_Graph_LoadFile(_HilPack_Graph *G, char *InFile, int Direction){
    FILE *F;
    char Strings[250],TwoChar[3];
    int L,Num,Kode;
    char From[100],To[100],S1[100],S2[100],Temp[100],StrVal[100];
    float Time,Value;
    F=fopen(InFile,"r");
    if (F==NULL)
        return 0;
    else
     {
       fgets(Strings,_HilPack_Graph_ReadLine,F);
       while ((!_HilPack_General_SameStr(Strings,"@end"))&&(!feof(F))){
           _HilPack_General_DelChr(Strings);
           _HilPack_General_CopyStr(TwoChar,"");
           _HilPack_General_AddChr(TwoChar,Strings[0]);
           _HilPack_General_AddChr(TwoChar,Strings[1]);
           if (_HilPack_General_SameStr("@@",TwoChar)){
              _HilPack_General_DelChrF(Strings);
              _HilPack_General_DelChrF(Strings);
              _HilPack_General_CopyStr(Temp,Strings);
              fscanf(F,"%s %s %f",S1,S2,&Value);
              fgets(Strings,_HilPack_Graph_ReadLine,F);
              _HilPack_General_CopyStr(StrVal,"NULL");
              if (_HilPack_General_SameStr(S1,"Y")){
                 fscanf(F,"%s",StrVal);
                 fgets(Strings,_HilPack_Graph_ReadLine,F);
              }
              Kode=_HilPack_General_SameStr(S1,"Y")?2:0;
              Kode+=_HilPack_General_SameStr(S2,"Y")?1:0;
              _HilPack_Graph_AddNode(G, Temp, Value, StrVal, Kode);
           }
           else if (_HilPack_General_SameStr(Strings,"@edges")){
              fscanf(F,"%d",&Num);
              fgets(Strings,_HilPack_Graph_ReadLine,F);
              for (L=1;L<=Num;L++){
                  fscanf(F,"%s %s %f",From,To,&Time);
                  fgets(Strings,_HilPack_Graph_ReadLine,F);
                  if (Direction)
                     _HilPack_Graph_AddNodeTimeDirection(G, From, To, Time);
                  else
                     _HilPack_Graph_AddNodeTimeNoDirection(G, From, To, Time);
              }                                       
           }
           fgets(Strings,_HilPack_Graph_ReadLine,F);  
       }
       fclose(F);
       return 1;
    }
}

int _HilPack_Graph_LoadFileNoDirection(_HilPack_Graph *G, char *InFile){
   return _HilPack_Graph_LoadFile(G, InFile, 0);
}
int _HilPack_Graph_LoadFileDirection(_HilPack_Graph *G, char *InFile){
   return _HilPack_Graph_LoadFile(G, InFile, 1);
}

int _HilPack_Graph_NumGoTime(_HilPack_Graph G, int From, int To, float FileSize, _HilPack_Set_INT *PathResult, float *Result, _HilPack_Set_INT Path, float Traverse){
   int L,M;
   float ValTemp;
   _HilPack_Set_INT TempPath;
   if (!_HilPack_Set_INT_NoSetINT(Path))
      _HilPack_Set_INT_CopySetINTSize(&TempPath,Path,100);
   else {
      _HilPack_Set_INT_CreateSetINT(&TempPath,100);
      _HilPack_Set_INT_AddSetINT(&TempPath,From);
   }
   
   L= TempPath.Data[TempPath.Top];
   if (L==To) {
       if ((*Result>Traverse)||((*PathResult).Top>Path.Top)) {   
           *Result=Traverse;  
           _HilPack_Set_INT_CopySetINT(PathResult,Path);
       }  
   }
   else for (M=1;M<=G.Total;M++) {
       if ((G.Data[L][M]>0)&&(!_HilPack_Set_INT_ExistSetINT(TempPath, M))) {                                                           
            ValTemp=(Traverse)+(FileSize/(G.Data[L][M]*1000));
            _HilPack_Set_INT_AddSetINT(&TempPath,M);
            _HilPack_Graph_NumGoTime(G, From, To, FileSize, PathResult, Result, TempPath, ValTemp); 
            _HilPack_Set_INT_DelSetINT(&TempPath,M);              
       }
   }
   return 1;
}

int _HilPack_Graph_NumGoBackTime(_HilPack_Graph G, int From, int To, float FileSize, _HilPack_Set_INT *PathResult, _HilPack_Set_INT *PathBack, float *Result, _HilPack_Set_INT Path, float Traverse){
    float Go=_HilPack_Graph_LongDelay,Back=_HilPack_Graph_LongDelay;
    _HilPack_Set_INT Set1,Set2;
    _HilPack_Graph_NumGoTime(G, From, To, FileSize, &Set1, &Go, Path, Traverse);
    _HilPack_Graph_NumGoTime(G, To, From, FileSize, &Set2, &Back, Path, Traverse);
    *Result=Go+Back;
    if (*Result>_HilPack_Graph_LongDelay)
        *Result=_HilPack_Graph_LongDelay;
    _HilPack_Set_INT_CopySetINT(PathResult,Set1);
    _HilPack_Set_INT_CopySetINT(PathBack,Set2);
    return 1;
}

int _HilPack_Graph_PrintPath(_HilPack_Graph G, _HilPack_Set_INT Path){
    int L;
    char Strings[100];
    char Str2[100];
    if (_HilPack_Set_INT_NoSetINT(Path))
        return 0;
    else {
        for (L=1;L<Path.Top;L++){
            _HilPack_Hash_STR_GetSTRHashSTR(G.Node,Path.Data[L],Strings);
            _HilPack_Hash_STR_GetSTRHashSTR(G.Node,Path.Data[L+1],Str2);
            printf("%d : %s -> %s\n",L,Strings,Str2); 
        }
        return 1; 
    }
}

int _HilPack_Graph_GoTime(_HilPack_Graph G, char *From, char *To, float FileSize, _HilPack_Set_INT *PathResult, float *Result, _HilPack_Set_INT Path, float Traverse){
    int IntFrom, IntTo;
    if (!(_HilPack_Graph_ValidNode(G, From)&&_HilPack_Graph_ValidNode(G, To)))
        return 0;
    else {
        IntFrom=_HilPack_Hash_STR_GetIdxHashSTR(G.Node, From);
        IntTo=_HilPack_Hash_STR_GetIdxHashSTR(G.Node, To); 
        return _HilPack_Graph_NumGoTime(G, IntFrom, IntTo, FileSize, PathResult, Result, Path, Traverse);
    }
}

int _HilPack_Graph_GoBackTime(_HilPack_Graph G, char *From, char *To, float FileSize, _HilPack_Set_INT *PathResult, _HilPack_Set_INT *PathBack, float *Result, _HilPack_Set_INT Path, float Traverse){
    int IntFrom, IntTo;
    if (!(_HilPack_Graph_ValidNode(G, From)&&_HilPack_Graph_ValidNode(G, To)))
        return 0;
    else {
        IntFrom=_HilPack_Hash_STR_GetIdxHashSTR(G.Node, From);
        IntTo=_HilPack_Hash_STR_GetIdxHashSTR(G.Node, To); 
        return _HilPack_Graph_NumGoBackTime(G, IntFrom, IntTo, FileSize, PathResult, PathBack, Result, Path, Traverse);
    }
}

int _HilPack_Graph_PathNumGoTime(_HilPack_Graph G, int From, int To, float FileSize, _HilPack_Set_INT *PathResult, float *Result){
    _HilPack_Set_INT Set;
    float F=_HilPack_Graph_LongDelay;
    *Result=_HilPack_Graph_LongDelay;
    _HilPack_Set_INT_CreateSetINT(&Set,100);
    _HilPack_Set_INT_DeleteSetINT(PathResult);
    _HilPack_Set_INT_CreateSetINT(&Set,100);
    _HilPack_Graph_NumGoTime(G, From, To, FileSize, PathResult, Result, Set, F);
}

int _HilPack_Graph_PathNumGoBackTime(_HilPack_Graph G, int From, int To, float FileSize, _HilPack_Set_INT *PathResult, _HilPack_Set_INT *PathBack, float *Result){
    _HilPack_Set_INT Set;
    float F=_HilPack_Graph_LongDelay;
    *Result=_HilPack_Graph_LongDelay;
    _HilPack_Set_INT_CreateSetINT(&Set,100);
    _HilPack_Set_INT_DeleteSetINT(PathResult);
    _HilPack_Set_INT_CreateSetINT(&Set,100);
    _HilPack_Graph_NumGoBackTime(G, From, To, FileSize, PathResult, PathBack, Result, Set, F);
}

int _HilPack_Graph_PathGoTime(_HilPack_Graph G, char *From, char *To, float FileSize, _HilPack_Set_INT *PathResult, float *Result){
    _HilPack_Set_INT Set;
    float F=0;
    *Result=_HilPack_Graph_LongDelay;
    _HilPack_Set_INT_CreateSetINT(&Set,100);
    _HilPack_Set_INT_DeleteSetINT(PathResult);
    _HilPack_Set_INT_CreateSetINT(PathResult,100);
    _HilPack_Graph_GoTime(G, From, To, FileSize, PathResult, Result, Set, F);
}

int _HilPack_Graph_PathGoBackTime(_HilPack_Graph G, char *From, char *To, float FileSize, _HilPack_Set_INT *PathResult, _HilPack_Set_INT *PathBack, float *Result){
    _HilPack_Set_INT Set;
    float F=0;
    *Result=_HilPack_Graph_LongDelay;
    _HilPack_Set_INT_CreateSetINT(&Set,100);
    _HilPack_Set_INT_DeleteSetINT(PathResult);
    _HilPack_Set_INT_CreateSetINT(&Set,100);
    _HilPack_Graph_GoBackTime(G, From, To, FileSize, PathResult, PathBack, Result, Set, F);
}
